package com.jsgt.greekfire.ui.home.entrance

import android.content.Context
import android.content.Intent
import android.view.View
import com.fhx.core.base.BaseActivity
import com.fhx.core.goToActivity
import com.jsgt.greekfire.R
import com.jsgt.greekfire.ui.home.entrance.addwallet.LoginWalletActivity
import com.jsgt.greekfire.ui.home.entrance.createwallet.RegisterWalletActivity
import com.jsgt.greekfire.ui.home.entrance.walletList.WalletListActivity
import kotlinx.android.synthetic.main.activity_entrance.*
import kotlinx.android.synthetic.main.view_title.*
import org.jetbrains.anko.imageResource
import org.jetbrains.anko.textColorResource

/**
 * 创建/导入钱包
 */
class EntranceActivity : BaseActivity(), View.OnClickListener {
    override fun getLayoutId(): Int = R.layout.activity_entrance

    override fun needFitsSystemWindows(): Boolean {
        return false
    }

    companion object {
        fun start(context: Context) {
            context.startActivity(Intent(context, EntranceActivity::class.java))
        }
    }

    override fun main() {
        llCreate.setOnClickListener(this)
        //导入钱包
        llImport.setOnClickListener(this)
        //钱包列表
        llList.setOnClickListener(this)
        back.setOnClickListener(this)
        back.imageResource = R.mipmap.ic_back1
        title_layout.setBackgroundResource(R.color.transparent)
        title_tv.textColorResource = R.color.white
        title_tv.text = getString(R.string.wallet_management)
        setStatusBar(R.color.transparent, false, R.color.white)
    }

    override fun onClick(v: View?) {
        when (v?.id) {
            R.id.back -> {
                finish()
            }
            R.id.llCreate -> {
                startActivity(Intent(this, RegisterWalletActivity::class.java))
            }
            R.id.llImport -> {
                startActivity(Intent(this, LoginWalletActivity::class.java))
            }
            R.id.llList -> {
                goToActivity<WalletListActivity>()
            }
        }
    }
}